﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace NewRen.Models.ViewModel
{
    public class vNews
    {

        public int ID { get; set; }

        public string Title { get; set; }

        public string Content { get; set; }

        public string DateTime { get; set; }

        public string Url { get; set; }

        public string Source { get; set; }

        public string Category { get; set; }

        public string Area { get; set; }

        public string Summary { set; get; }

        public string TSummary
        {
            get;set;
        }

        public int Browses { get; set; }

        public vNews(News model)
        {
            this.ID = model.ID;
            this.Title = model.Title;
            this.Content = model.Content;
            this.DateTime = model.DateTime.ToString();
            this.Source = model.Source;
            this.Url = model.Url;
            this.Browses = model.Browses;
            this.TSummary = Helpers.String.GetStr2(Content,500, "....");
            if (string.IsNullOrEmpty(model.Summary))
            {
                this.Summary = Helpers.String.CleanHTML(Helpers.HtmlFilter.Instance.SanitizeHtml(this.TSummary));
            }
            else
            {
                this.Summary = Helpers.String.CleanHTML(Helpers.HtmlFilter.Instance.SanitizeHtml(model.Summary));
            }
        }
    }
}